//
// Created by Whg on 2019-09-23.
//
#include <cstdint>
#include <faac.h>
#include <sys/types.h>
#include <jni.h>
#include "librtmp/rtmp.h"

#ifndef WHGPUSH_AUDIOCHANNEL_H
#define WHGPUSH_AUDIOCHANNEL_H


class AudioChannel {
    typedef void(*AudioCallback)(RTMPPacket *packet);

private:
    int mChannels;
    faacEncHandle audioCodec;
    u_long inputSamples;
    u_long maxOutputBytes;
    u_char *buffer = 0;
    AudioCallback audioCallback;
public:
    void encodeData(int8_t *data);

    void setAudioEncInfo(int samplesInHZ, int channels);

    jint getInputSamples();

    void setAudioCallback(AudioCallback videoCallback);

    RTMPPacket *getAudioTag();

};


#endif //WHGPUSH_AUDIOCHANNEL_H
